/*
 * Copyright (c) 2005, 2019, EVECOM Technology Co.,Ltd. All rights reserved.
 * EVECOM PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 */
package com.ruoyi.common.enums;

import lombok.Getter;

import java.util.Arrays;

/**
 * 区域Region
 *
 * @author Leon Li
 * @date 2023/6/8 9:46
 */
@Getter
public enum RegionEnum {

    /**
     * 鼓楼区
     */
    GULOU_CODE("350102", "鼓楼区"),

    /**
     * 台江区
     */
    TAIJIANG_CODE("350103", "台江区"),

    /**
     * 仓山区
     */
    CANGSHAN_CODE("350104", "仓山区"),

    /**
     * 晋安区
     */
    JINAN_CODE("350111", "晋安区"),

    /**
     * 马尾区
     */
    MAWEI_CODE("350105", "马尾区");

    /**
     * 区域编号
     */
    private final String code;

    /**
     * 区域名称
     */
    private final String codeName;

    RegionEnum(String code, String codeName) {
        this.code = code;
        this.codeName = codeName;
    }

    public static RegionEnum format(String code) {
        return Arrays.stream(RegionEnum.values()).filter(region -> region.getCode().equals(code)).findFirst().get();
    }
}
